<%@page import="demo.Customer"%>

<%@page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<!

DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<title>Test Bean dans JSP</title>
</head>
<body>
	<%=new java.util.Date()%>
	<h1>Customer</h1>
	<%="<br>"%>
	<%="Bonjour Monsieur"%>
	<%
		Customer customer = (Customer) session.getAttribute("cust");
		out.println(customer.getNom());
		//Used when restart the page
		if (session.getAttribute("cust") == null) 
		{
			customer = new Customer(1, "Henri", "Dupont", "rue des roses");
			session.setAttribute("cust", customer);
		}
		out.println(session.getAttribute("cust"));
	%>
	<% String c = ((Customer)session.getAttribute("cust")).getNom(); %>
<table border="1">
<tr><th>id</th><th>nom</th><th>prenom</th></tr>
<% 
java.util.List<Customer> customers = (java.util.List<Customer>)session.getAttribute("custs");
for (Customer cus:customers) 
{
	%>
	<tr><td><%=cus.getId()%></td><td><%=cus.getNom()%></td><td><%=cus.getPrenom()%></td></tr>
	<% 
}
%>

</table>

</body>
</html>
